﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GrayParrot.RabbitMQ.Configuration
{
    /// <summary>
    /// Subscription setting class...
    /// </summary>
    /// <seealso cref="System.Configuration.ConfigurationElement" />
    public class Subscription : ConfigurationElement
    {
        /// <summary>
        /// Gets or sets the connection string.
        /// </summary>
        /// <value>
        /// The connection string for connects to the service bus endpoint...
        /// </value>
        public string ConnectionString { get; set; }

        /// <summary>
        /// Gets or sets the subscription.
        /// </summary>
        /// <value>
        /// The service bus subscription...
        /// </value>
        [ConfigurationProperty("name", IsRequired = true, IsKey = true)]
        public string Name
        {
            get { return (string)base["name"]; }
            set { base["name"] = value; }
        }

        /// <summary>
        /// Gets or sets the topic.
        /// </summary>
        /// <value>
        /// The service bus topic.
        /// </value>
        [ConfigurationProperty("exchange", IsRequired = true, IsKey = false)]
        public string Exchange
        {
            get { return (string)base["exchange"]; }
            set { base["exchange"] = value; }
        }

        /// <summary>
        /// Gets or sets the routing key.
        /// </summary>
        /// <value>
        /// The routing key.
        /// </value>
        [ConfigurationProperty("routingKey", IsRequired = false, IsKey = false)]
        public string RoutingKey
        {
            get { return (string)base["routingKey"]; }
            set { base["routingKey"] = value; }
        }

        /// <summary>
        /// Gets or sets a value indicating whether [read from dead letter].
        /// </summary>
        /// <value>
        ///   <c>true</c> if [can read from dead letter]; otherwise, <c>false</c>.
        /// </value>
        [ConfigurationProperty("readDL", IsRequired = false, IsKey = false)]
        public bool ReadDL
        {
            get { return (bool)base["readDL"]; }
            set { base["readDL"] = value; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Endpoint"/> class.
        /// </summary>
        public Subscription()
        {

        }
    }
}
